using System;
using System.Collections.Generic;
using System.Text;

namespace Chapter7CustomControlsCS
{
    public class MyLicensingProvider : System.ComponentModel.LicenseProvider
    {
        public override System.ComponentModel.License 
            GetLicense(System.ComponentModel.LicenseContext context, 
                        Type type, 
                        object instance, 
                        bool allowExceptions)
        {
         SampleLicense lic = new SampleLicense();

            if (lic.LicenseKey == "OK")
            {
                return lic;
            }
            else
            {
                if (allowExceptions)
                {
                    throw new System.ComponentModel.LicenseException(type);
                }
                return null;
            }
        }
        
    }
}
